package com.example.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.PersistenceUnit;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
import org.hibernate.id.enhanced.TableGenerator;

import com.example.util.Const;

@Entity
@Table(name="book")
@PersistenceUnit(name="persistenceUnit")
//@JsonPropertyOrder({"id", "name", "price" }) //json字符串排序
public class Book {
  @Id
  @Column(name="id")
  @GeneratedValue(generator =Const.table_generator)  
  @GenericGenerator(name =Const.table_generator, strategy =Const.tableName,   
  parameters = { 
		   @Parameter(name = "timedate", value = "yyyyMMdd"),
		    @Parameter(name=Const.Seq_fmtWidth,value="14"),
			@Parameter(name = TableGenerator.SEGMENT_COLUMN_PARAM, value = "id"),
			@Parameter(name = TableGenerator.SEGMENT_VALUE_PARAM, value = "bookid"),
			@Parameter(name = TableGenerator.VALUE_COLUMN_PARAM, value = "SEQ"),
			@Parameter(name = TableGenerator.TABLE_PARAM, value = "tseq"),
			@Parameter(name=TableGenerator.INCREMENT_PARAM,value="1000")
		   }) 

  private String id;
  @Column(name="name")
  private String name;
  @Column(name="price")
  private long price;
  
  @Enumerated(EnumType.STRING)
  @Column(name="book_name")
  private BookEnum be;
public String getId() {
	return id;
}


public void setId(String id) {
	this.id = id;
}
public String getName() {
	return name;
}
public void setName(String name) {
	this.name = name;
}
public long getPrice() {
	return price;
}
public void setPrice(long price) {
	this.price = price;
}


public BookEnum getBe() {
	return be;
}


public void setBe(BookEnum be) {
	this.be = be;
}

  
	
}
